package images_api

import (
	"github.com/gin-gonic/gin"
	"gvb_server/global"
	"gvb_server/models"
	"gvb_server/models/res"
)

func (ImagesApi) ImagesRemove(c *gin.Context) {
	var idList models.RemoveRequest
	err := c.ShouldBindJSON(&idList)
	if err != nil {
		res.FailCode(res.ArgumentError, c)
		return
	}
	var bannerList []models.BannerModel
	for _, id := range idList.IDList {
		bannerList = append(bannerList, models.BannerModel{Model: models.Model{ID: id}})
	}
	global.DB.Delete(&bannerList)
	//global.DB.Delete(&bannerList, idList.IDList)
	res.OkWithMessage("删除成功", c)
}
